package chapter4.No4_1_使用reentrantLock类.demo12;

import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by Administrator on 2016/11/21.
 */
public class ServiceClass2 {
    ReentrantLock lock = new ReentrantLock();

    public void methodA() {
        lock.lock();
        try {
            System.out.println("线程"+Thread.currentThread().getName()+"开始执行!");
            Thread.sleep(Integer.MAX_VALUE);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        lock.unlock();
    }
}
